package com.nercel.dsj.gksales.exception;

import org.slf4j.Logger;

/**
 * @author qinshuangxi
 * @date 2020-06-22
 */
public class ExceptionUtil {

	/**
	 * 替代e.printStackTrace()方法将日志打到log文件里面去
	 */
	public static void printStackTrace2Log(Throwable th, Logger logger) {
		logger.error(th.getMessage());
		StackTraceElement[] stackTrace = th.getStackTrace();
		for (StackTraceElement st : stackTrace) {
			logger.error(st.toString());
		}
	}
}
